<?php /*a:2:{s:91:"C:\application\phpStudy\PHPTutorial\WWW\magic\test\application\admin\view\orders\order.html";i:1542605994;s:90:"C:\application\phpStudy\PHPTutorial\WWW\magic\test\application\admin\view\public\base.html";i:1542098545;}*/ ?>
<!DOCTYPE html>
<html>

<head>
    <meta charset="UTF-8">
    <title><?php echo htmlentities($title); ?></title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8,target-densitydpi=low-dpi" />
    <link rel="shortcut icon" href="/favicon.ico" type="image/x-icon" />
    <link rel="stylesheet" type="text/css" href="/static/admin/css/font.css" />
    <link rel="stylesheet" type="text/css" href="/static/admin/css/xadmin.css" />

    <script type="text/javascript" src="/static/admin/js/jquery.min.js"></script>
    <script type="text/javascript" src="/static/admin/lib/layui/layui.js"></script>
    <script type="text/javascript" src="/static/admin/js/global.js"></script>
    <script type="text/javascript" src="/static/admin/js/xadmin.js"></script>
    <script type="text/javascript" src="/static/common/js/common.js"></script>
    <script type="text/javascript" src="/static/admin/js/xcity.js"></script>
    <!-- 让IE8/9支持媒体查询，从而兼容栅格 -->
    <!--[if lt IE 9]>
    <script src="https://cdn.staticfile.org/html5shiv/r29/html5.min.js"></script>
    <script src="https://cdn.staticfile.org/respond.js/1.4.2/respond.min.js"></script>
    <![endif]-->
</head>

<body>
<div class="x-nav">
      <span class="layui-breadcrumb">
        <a href="javascript:void(0);"><?php echo htmlentities($navigate[0]); ?></a>
        <a>
          <cite><?php echo htmlentities($navigate[1]); ?></cite>
        </a>
      </span>
    <a class="layui-btn layui-btn-small" style="line-height:1.6em;margin-top:3px;float:right" href="javascript:location.replace(location.href.split('?')[0]);" title="刷新">
        <i class="layui-icon" style="line-height:30px">&#xe669;</i></a>
</div>

    <div class="x-body">
      <blockquote class="layui-elem-quote">
        <span style="color: red;">提示：搜索日期条件将开始日和结束日填写完整，否则将为无效搜索</span>
      </blockquote>
      <div class="layui-row">
        <form class="layui-form layui-col-md12 x-so" method="get">
          <input class="layui-input" placeholder="开始日" name="start" value="<?php echo htmlentities($search_key['start']); ?>" id="start">
          <input class="layui-input" placeholder="截止日" name="end" value="<?php echo htmlentities($search_key['end']); ?>" id="end">
          <div class="layui-input-inline">
            <select name="pay_status">
              <option value="">支付状态</option>
              <option value="1" <?php echo $search_key['pay_status']==1 ? 'selected'  :  ''; ?>>已支付</option>
              <option value="0" <?php echo $search_key['pay_status']==='0' ? 'selected'  :  ''; ?>>未支付</option>
            </select>
          </div>
          <div class="layui-input-inline">
            <select name="shipping_status">
              <option value="">发货状态</option>
              <option value="0" <?php echo $search_key['shipping_status']==='0' ? 'selected'  :  ''; ?>>未发货</option>
              <option value="2" <?php echo $search_key['shipping_status']==2 ? 'selected'  :  ''; ?>>部分发货</option>
              <option value="1" <?php echo $search_key['shipping_status']==1 ? 'selected'  :  ''; ?>>已发货</option>
            </select>
          </div>
          <div class="layui-input-inline">
            <select name="pay_code">
              <option value="">支付方式</option>
              <?php if(is_array($list['pay']) || $list['pay'] instanceof \think\Collection || $list['pay'] instanceof \think\Paginator): $i = 0; $__LIST__ = $list['pay'];if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$v): $mod = ($i % 2 );++$i;?>
                <option value="<?php echo htmlentities($v['code']); ?>" <?php echo $search_key['pay_code']==$v['code'] ? 'selected'  :  ''; ?>><?php echo htmlentities($v['name']); ?></option>
              <?php endforeach; endif; else: echo "" ;endif; ?>
            </select>
          </div>
          <div class="layui-input-inline">
            <select name="order_status">
              <option value="">订单状态</option>
              <option value="0" <?php echo $search_key['order_status']==='0' ? 'selected'  :  ''; ?>>未确认</option>
              <option value="1" <?php echo $search_key['order_status']==1 ? 'selected'  :  ''; ?>>已确认</option>
              <option value="2" <?php echo $search_key['order_status']==2 ? 'selected'  :  ''; ?>>已收货</option>
              <option value="3" <?php echo $search_key['order_status']==3 ? 'selected'  :  ''; ?>>已取消</option>
              <option value="4" <?php echo $search_key['order_status']==4 ? 'selected'  :  ''; ?>>已完成</option>
              <option value="5" <?php echo $search_key['order_status']==5 ? 'selected'  :  ''; ?>>已作废</option>
            </select>
          </div>
          <input type="text" name="order_sn"  placeholder="请输入订单号" autocomplete="off" class="layui-input" value="<?php echo htmlentities($search_key['order_sn']); ?>">
          <button class="layui-btn"  lay-submit="" lay-filter="sreach"><i class="layui-icon">&#xe615;</i></button>
        </form>
      </div>
      <xblock style="height: 40px;">
        <span class="x-right" style="line-height:40px">共有数据：<?php echo htmlentities($list['list'] -> total()); ?> 条</span>
      </xblock>
      <table class="layui-table">
        <thead>
          <tr>
            <th>ID</th>
            <th>订单编号</th>
            <th>收货人</th>
            <th>总金额</th>
            <th>应付金额</th>
            <th>订单状态</th>
            <th>支付状态</th>
            <th>发货状态</th>
            <th>支付方式</th>
            <th>配送方式</th>
            <th>下单时间</th>
            <th>操作</th>
            </tr>
        </thead>
        <tbody>
          <?php if(is_array($list['list']) || $list['list'] instanceof \think\Collection || $list['list'] instanceof \think\Paginator): $i = 0; $__LIST__ = $list['list'];if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$v): $mod = ($i % 2 );++$i;?>
            <tr>
              <td><?php echo htmlentities($v['id']); ?></td>
              <td><?php echo htmlentities($v['order_sn']); ?></td>
              <td><?php echo htmlentities($v['consignee']); ?>:<?php echo htmlentities($v['mobile']); ?></td>
              <td>
                <?php if($v['integral']): ?>
                  <img src="/static/common/images/integral.png" width="20" alt=""> <?php echo htmlentities($v['integral']); else: ?>
                  <img src="/static/common/images/money.png" width="20" alt=""> <?php echo htmlentities($v['total_amount']); ?>
                <?php endif; ?>
              </td>
              <td>
                <?php if($v['integral']): ?>
                <img src="/static/common/images/integral.png" width="20" alt=""> <?php echo htmlentities($v['integral']); else: ?>
                <img src="/static/common/images/money.png" width="20" alt=""> <?php echo htmlentities($v['order_amount']); ?>
                <?php endif; ?>
              </td>
              <td>
                <?php switch($v['order_status']): case "0": ?>未确定<?php break; case "1": ?>已确定<?php break; case "2": ?>已收货<?php break; case "3": ?>已取消<?php break; case "4": ?>已完成<?php break; case "5": ?>已作废<?php break; ?>
                <?php endswitch; ?>
              </td>
              <td><?php echo $v['pay_status']==1 ? '已支付'  :  '未支付'; ?></td>
              <td>
                <?php if($v['shipping_status'] == 1): ?>
                  已发货
                <?php elseif($v['shipping_status'] == 2): ?>
                  部分发货
                <?php else: ?>
                  未发货
                <?php endif; ?>
              </td>
              <td><?php echo htmlentities($v['pay_name']); ?></td>
              <td><?php echo htmlentities($v['shipping_name']); ?></td>
              <td><?php echo htmlentities(date("Y-m-d H:i",!is_numeric($v['add_time'])? strtotime($v['add_time']) : $v['add_time'])); ?></td>
              <td class="td-manage">
                <a title="订单查看"  onclick="x_admin_show('订单编辑','<?php echo url('orders/order_cat', ['id' => $v['id']]); ?>')" href="javascript:;">
                  <i class="layui-icon">&#xe63c;</i>
                </a>
              </td>
            </tr>
          <?php endforeach; endif; else: echo "" ;endif; ?>
        </tbody>
      </table>
      <div class="page">
        <?php echo $list['list'] -> render(); ?>
      </div>

    </div>


<script>
    layui.use('laydate', function(){
        var laydate = layui.laydate;

        //执行一个laydate实例
        laydate.render({
            elem: '#start' //指定元素
        });

        //执行一个laydate实例
        laydate.render({
            elem: '#end' //指定元素
        });
    });

    /*用户-停用*/
    function member_stop(obj,id,url){
        var title = $(obj).attr('title');
        var status = $(obj).data('status');

        layer.confirm('确认要'+ title +'吗？',function(index){
            var token = $("input[name='__token__']",top.window.document).val();
            $.post(url, {'status': status, '__token__': token, 'id': id}, function(res){
                if(res.code == 1){
                    var title = '停用',icon = '&#xe601;',text = '已启用',expr = 6;
                    if(res.data.status == 0){
                        title = '启用';
                        icon = '&#xe62f;';
                        text = '已停用';
                        expr = 5;

                        $(obj).parents("tr").find(".td-status").find('span').addClass('layui-btn-disabled').html(text);
                        $(obj).data('status', '1');
                    }else{
                        $(obj).parents("tr").find(".td-status").find('span').removeClass('layui-btn-disabled').html(text);
                        $(obj).data('status', '0');
                    }
                }else{
                    text = res.msg;
                }

                $(obj).attr('title',title)
                $(obj).find('i').html(icon);

                layer.msg(text,{icon: expr,time:1000});

                var token = $("input[name='__token__']",top.window.document).val(res.data.token);
            }, 'json');
        });
    }

    /*用户-删除*/
    function member_del(obj,id, url, fn = false){
        layer.confirm('确认要删除吗？',function(index){
            var token = $("input[name='__token__']",top.window.document).val();
            //发异步删除数据
            $.post(url, {'id': id, '__token__': token},function(res){
                var icon = 2;
                if(res.code == 1){
                    $(obj).parents("tr").remove();
                    icon = 1;
                }
                $("input[name='__token__']",top.window.document).val(res.data.token);
                layer.msg(res.msg, {icon:icon,time:1000}, function(){
                    if(fn)fn();
                });

            },'json');
        });
    }

    function delAll (url) {
        var data = tableCheck.getData();
        var token = $("input[name='__token__']",top.window.document).val();

        layer.confirm('确认要删除吗？'+data,function(index){
            //捉到所有被选中的，发异步进行删除
            $.post(url, {'id': data, '__token__': token},function(res){
                var icon = 2;
                if(res.code == 1){
                    $(".layui-form-checked").not('.header').parents('tr').remove();
                    icon = 1;
                }
                $("input[name='__token__']",top.window.document).val(res.data.token);
                layer.msg(res.msg, {icon:icon,time:1000});
            },'json');
        });
    }

    // 跳转地址
    function load_url(url){
        window.location.href = url;
    }

</script>
<script>var _hmt = _hmt || []; (function() {
    var hm = document.createElement("script");
    hm.src = "https://hm.baidu.com/hm.js?b393d153aeb26b46e9431fabaf0f6190";
    var s = document.getElementsByTagName("script")[0];
    s.parentNode.insertBefore(hm, s);
})();</script>
</body>

</html>